package com.roy.spring.jpa.service;

import com.roy.spring.jpa.domain.Order;
import com.roy.spring.jpa.domain.OrderRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

/**
 * Created by admin on 17-12-17.
 */
@Service
public class OrderService {
    @Autowired
    private OrderRepository orderRepository;

    public Order findByCustName(String custName) {
        Assert.hasText(custName, "custName should not empty!");

        return orderRepository.findByCustName(custName);
    }

    public Order save(Order order) {
        return orderRepository.save(order);
    }

}
